package com.binfei.yjs.server;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@EnableAsync
@EnableCaching
@EnableScheduling
@SpringBootApplication
public class ServerApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ServerApplication.class, args);
        log.debug("应用已完成启动!!!");
        log.debug(
                "\n应用已启动!\n" +
                        "\tLocal:\thttp://localhost:{}\n" +
                        "\tExternal:\thttp://{}:{}\n" +
                        "\tDoc:\thttp://{}:{}/doc.html\n",
                applicationContext.getEnvironment().getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                applicationContext.getEnvironment().getProperty("server.port"),
                InetAddress.getLocalHost().getHostAddress(),
                applicationContext.getEnvironment().getProperty("server.port")
        );
    }

}
